<script setup>
import { onMounted, nextTick, ref, reactive, watch, toRefs, watchEffect } from 'vue'
import mitt from "../assets/js/mitt"
const props = defineProps({
  num: {
    type: Number,
    default: () => (1)
  },
  testArr: {
    type: Array,
    default: () => ({})
  }
})
let { num, testArr } = toRefs(props)

// const stopWatch=watch([num,testArr],([n,n1],[o,o1])=>{
//   console.log(n,n1);
// })  
// watch(testArr,(n,o)=>{
//   console.log(n);
// },{
//   deep:true
// })

watchEffect(() => {
  // 这个深度高级呀
  // console.log(testArr.value.age)
}) 

onMounted(()=>{
  setTimeout(()=>{
    // 只能发射一个参数
  mitt.emit("test1",testArr.value)
  },1000)
})
</script>

<template>
  <!-- <p>{{num}}</p> -->
  <!-- <p>{{testArr.age}}</p> -->
</template>

<style lang='less'>

</style>